<template>
  <div>
    <div class="box" v-for="item in workInfoList" :key="item.id">
      <div class="name">
        <a @click="gotoRoute(item.id)">{{ item.name }}</a>
      </div>
      <div class="word">
        <div class="location">
          校区要求： <span>{{ item.location }} </span>
        </div>
        <div class="sex">
          性别要求： <span>{{ item.sex }}</span>
        </div>
      </div>
      <div class="time">
        截止日期：<span>{{ item.deadline }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "WorkInfoLIst",
  data() {
    return {
      workInfoList: []
    };
  },
  mounted() {
    this.getAllWorkInfoList();
  },
  methods: {
    gotoRoute(id) {
      this.$router.push({
        name: "WorkInfoDetails",
        params: {
          id: id
        }
      });
    },
    getAllWorkInfoList() {
      this.$axios
        .get("/workStudyInfoList")
        .then(res => {
          this.workInfoList = res.data.data.list;
        })
        .catch(error => {
          console.log(error);
        });
    }
  }
};
</script>

<style scoped>
ul {
  list-style: none;
}
body {
  font-family: "Microsoft YaHei", "Helvitica Neue", Helvitica, Arial, sans-serif;
  list-style-type: none;
  background-color: #f0f0f0;
}

.box {
  border-bottom: 2px solid #dcdcdc;
  box-sizing: border-box;
  margin: 8px 28px;
  padding: 16px 0;
  position: relative;
}

.name {
  font-size: 1.1em;
}

.name a:hover {
  color: orange;
  cursor: pointer;
}

.word {
  font-size: 1em;
  color: grey;
  height: 25px;
}

.location {
  float: left;
}

.sex {
  float: right;
}

.time {
  font-size: 0.9em;
  color: grey;
}
</style>
